/*
 * @Author: your name
 * @Date: 2021-02-16 17:18:33
 * @LastEditTime: 2021-02-17 11:53:56
 * @LastEditors: Please set LastEditors
 * @Description: 统计接口
 * @FilePath: \jianfa-api\routes\web\sta.js
 */
const express = require('express');
const router = express.Router();
const Result = require('../../models/result');
const { callService } = require('../../service/staCallServce');
//发起一个统计
router.post('/call', async (req, res, next) => {
 const { status } = await callService(req.ip.replace(/::ffff:/,''))
 if (status) {
  new Result({ ip: req.ip.replace(/::ffff:/,'') }, '访问成功').success(res)
 }else{
  new Result({ ip: req.ip.replace(/::ffff:/,'') }, '访问失败').fail(res)
 }

})


module.exports = router;
